package com.yz.group1.group_1.controller;

import com.yz.group1.group_1.entity.Doctor;
import com.yz.group1.group_1.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/doctor")
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    // 查询所有医生
    @GetMapping
    public List<Doctor> listAllDoctors() {
        return doctorService.listAllDoctors();
    }

    // 按科室ID查询医生
    @GetMapping("/byDepartment")
    public List<Doctor> getByDepartmentId(@RequestParam Integer departmentId) {
        return doctorService.getByDepartmentId(departmentId);
    }
}